home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dskut / mmv10.zip / MMV.1 < prev    next >
Text File  |  1989-11-22  |  18KB  |  658 lines

  1. .\" Under BSD, just give to nroff or troff (with -man).
  2. .\" To print the MS-DOS version, use option -rO2.
  3. .\" Under System V, take out the '.\"  ' from the next line.
  4. .\" .nr O 1
  5. .TH MMV 1 "November 20, 1989 (v1.0)"
  6. .ie !'\nO'2' \{\
  7. .SH NAME
  8. mmv \- move/copy/append/link multiple files by wildcard patterns
  9. \}
  10. .el \{
  11. .SH NAME
  12. mmv \- move/copy/append multiple files by wildcard patterns
  13. \}
  14. .ie '\nO'2' \{\
  15. .ds SL \\\\
  16. .ds ES '
  17. \}
  18. .el \{\
  19. .ds SL /
  20. .ds ES \\\\
  21. \}
  22. .SH SYNOPSIS
  23. .B mmv
  24. .if '\nO'2' [\fB-m\fP|\fBx\fP|\fBr\fP|\fBc\fP|\fBo\fP|\fBa\fP|\fBz\fP]
  25. .if '\nO'0' [\fB-m\fP|\fBx\fP|\fBr\fP|\fBc\fP|\fBo\fP|\fBa\fP|\fBl\fP|\fBs\fP]
  26. .if '\nO'1' [\fB-m\fP|\fBx\fP|\fBr\fP|\fBc\fP|\fBo\fP|\fBa\fP|\fBl\fP]
  27. [\fB-h\fP]
  28. [\fB-d\fP|\fBp\fP]
  29. [\fB-g\fP|\fBt\fP]
  30. [\fB-v\fP|\fBn\fP]
  31. [\fBfrom to\fP]
  32. .if '\nO'2' \{\
  33. .br
  34. .B mmvpatch
  35. [\fBexecutable\fP]
  36. \}
  37. .SH "DESCRIPTION"
  38. .I Mmv
  39. moves (or copies,
  40. .ie '\nO'2' or appends,
  41. .el appends, or links,
  42. as specified)
  43. each source file matching a
  44. .I from
  45. pattern to the target name specified by the
  46. .I to
  47. pattern.
  48. This multiple action is performed safely,
  49. i.e. without any unexpected deletion of files
  50. due to collisions of target names with existing filenames
  51. or with other target names.
  52. Furthermore, before doing anything,
  53. .I mmv
  54. attempts to detect any errors that would result
  55. from the entire set of actions specified
  56. and gives the user the choice of either
  57. proceeding by avoiding the offending parts
  58. or aborting.
  59.  
  60. .ce
  61. The Task Options
  62. .PP
  63. Whether
  64. .I mmv
  65. moves, copies,
  66. .ie '\nO'2' or appends
  67. .el appends, or links
  68. is governed by the first set of options given
  69. above.
  70. If none of these are specified,
  71. .ie '\nO'2' \{\
  72. a default (patchable by
  73. .IR mmvpatch ,
  74. and initially -x)
  75. determines the task.
  76. \}
  77. .el \{\
  78. the task is given by the command name under which
  79. .I mmv
  80. was invoked (argv[0]):
  81.  
  82.     command name    default task
  83.  
  84.     mmv            -x
  85. .br
  86.     mcp            -c
  87. .br
  88.     mad            -a
  89. .br
  90.     mln            -l
  91. \}
  92. .PP
  93. The task option choices are:
  94. .TP
  95. -m :
  96. move source file to target name.
  97. Both must be on the same device.
  98. Will not move directories.
  99. .if '\nO'0' \{\
  100. If the source file is a symbolic link,
  101. moves the link without checking if the link's target from the new
  102. directory is different than the old.
  103. \}
  104. .TP
  105. -x :
  106. same as -m, except cross-device moves are done
  107. by copying, then deleting source.
  108. When copying, sets the
  109. .ie !'\nO'2' permission bits
  110. .el attributes
  111. and file modification time
  112. of the target file to that of the source file.
  113. .TP
  114. -r :
  115. rename source file or directory to target name.
  116. The target name must not include a path:
  117. the file remains in the same directory in all cases.
  118. This option is the only way of renaming directories under
  119. .IR mmv .
  120. .if '\nO'2' It is only available under DOS version 3.0 or higher.
  121. .TP
  122. -c :
  123. copy source file to target name.
  124. Sets the file modification time and
  125. .ie !'\nO'2' permission bits
  126. .el attributes
  127. of the target file to that of the source file,
  128. regardless of whether the target file already exists.
  129. Chains and cycles (to be explained below) are not allowed.
  130. .TP
  131. -o :
  132. overwrite target name with source file.
  133. .ie '\nO'2' \{\
  134. If target file exists, its attributes are left unchanged.
  135. If not, it is created with ordinary attributes
  136. unrelated to the source file's attributes.
  137. In either case, the file modification time is set to the current time.
  138. \}
  139. .el \{\
  140. If target file exists, it is overwritten,
  141. keeping its original owner and permission bits.
  142. If it does not exist, it is created, with read-write permission bits
  143. set according to
  144. .IR umask (1),
  145. and the execute permission bits copied from the source file.
  146. In either case, the file modification time is set to the current time.
  147. \}
  148. .TP
  149. -a :
  150. append contents of source file to target name.
  151. Target file modification time is set to the current time.
  152. If target file does not exist,
  153. it is created with
  154. .ie '\nO'2' attributes
  155. .el permission bits
  156. set as under -o.
  157. Unlike all other options, -a allows multiple source files to have the
  158. same target name, e.g. "mmv -a
  159. .ie '\nO'2' *.c
  160. .el \\*.c
  161. big" will append all ".c" files to "big".
  162. Chains and cycles are also allowed, so "mmv -a f f" will double up "f".
  163. .ie '\nO'2' \{\
  164. .TP
  165. -z :
  166. same as -a, but if the target file exists, and its last character is a ^Z,
  167. and the source file is not empty,
  168. this ^Z is truncated before doing the append.
  169. \}
  170. .el \{\
  171. .TP
  172. -l :
  173. link target name to source file.
  174. Both must be on the same device,
  175. and the source must not be a directory.
  176. Chains and cycles are not allowed.
  177. .if '\nO'0' \{\
  178. .TP
  179. -s :
  180. same as -l, but use symbolic links instead of hard links.
  181. For the resulting link to aim back at the source,
  182. either the source name must begin with a '/',
  183. or the target must reside in either the current or the source directory.
  184. If none of these conditions are met, the link is refused.
  185. However, source and target can reside on different devices,
  186. and the source can be a directory.
  187. \}
  188. \}
  189. .PP
  190. Only one of these option may be given,
  191. and it applies to all matching files.
  192. Remaining options need not be given separately,
  193. i.e. "mmv -mk" is allowed.
  194.  
  195. .ce
  196. Multiple Pattern Pairs
  197. .PP
  198. Multiple
  199. .I from
  200. --
  201. .I to
  202. pattern pairs may be specified by omitting
  203. the pattern pair on the command line,
  204. and entering them on the standard input,
  205. one pair per line.
  206. (If a pattern pair is given on the command line,
  207. the standard input is not read.)
  208. Thus,
  209.  
  210. .in +3
  211. mmv
  212. .br
  213. a b
  214. .br
  215. c d
  216. .in -3
  217.  
  218. would rename "a" to "b" and "c" to "d".
  219. If a file can be matched to several of the given
  220. .I from
  221. patterns,
  222. the
  223. .I to
  224. pattern of the first matching pair is used.
  225. Thus,
  226.  
  227. .in +3
  228. mmv
  229. .br
  230. a b
  231. .br
  232. a c
  233. .in -3
  234.  
  235. would give the error message "a -> c : no match" because file "a"
  236. (even if it exists)
  237. was already matched by the first pattern pair.
  238.  
  239. .ce
  240. The \fIFrom\fP Pattern
  241. .PP
  242. The
  243. .I from
  244. pattern is a filename
  245. with embedded wildcards: '*', '?', '['...']',
  246. .if '\nO'2' \{\
  247. \'!',
  248. \}
  249. and ';'.
  250. The first three have their usual
  251. .IR sh (1)
  252. meanings of, respectively,
  253. matching any string of characters,
  254. matching any single character,
  255. and matching any one of a set of characters.
  256. .PP
  257. Between the '[' and ']', a range from character 'a' through character 'z'
  258. is specified with "a-z".
  259. The set of matching characters can be negated by inserting
  260. a '^' after the '['.
  261. Thus, "[^b-e2-5_]"
  262. will match any character but 'b' through 'e', '2' through '5', and '_'.
  263. .if '\nO'2' \{\
  264. .PP
  265. Unlike DOS wildcards,
  266. all mmv wildcards (except for cases listed below)
  267. can occur anywhere in the pattern,
  268. whether preceding or following explicit characters or other wildcards.
  269. For example, the pattern "*z\\foo.bar" will search
  270. for files named "foo.bar" in all subdirectories whose names end in 'z'.
  271. However, no wildcards can occur in the drive letter.
  272. .PP
  273. The character '.' is not matched by any of '*', '?', or '['...']'.
  274. Thus, the pattern "*" will only match files with a null extension.
  275. To save yourself some typing, use the '!' wildcard instead,
  276. which matches the same as "*.*",
  277. except it is assigned only one wildcard index (see below).
  278. Thus, both "f!" and "f*.*"
  279. will match all of "f", "f.ext", "foo", and "foo.ext",
  280. while "f*" will match only the first and the third.
  281. \}
  282. .PP
  283. Note that paths are allowed in the patterns,
  284. and wildcards may be intermingled with slashes arbitrarily.
  285. The ';' wildcard
  286. is useful for matching files at any depth in the directory tree.
  287. It matches the same as "*\*(SL" repeated any number of times, including zero,
  288. and can only occur either at the beginning of the pattern
  289. or following a '\*(SL'.
  290. Thus ";*.c" will match all ".c" files in or below the current directory,
  291. while "\*(SL;*.c" will match them anywhere on the file system.
  292. .if !'\nO'2' \{\
  293. .PP
  294. In addition, if the
  295. .I from
  296. pattern
  297. (or the
  298. .I to
  299. pattern)
  300. begins with "~/", the '~' is replaced with the home directory name.
  301. (Note that the "~user" feature of
  302. .IR csh (1)
  303. is not implemented.)
  304. However, the '~' is not treated as a wildcard,
  305. in the sense that it is not assigned a wildcard index (see below).
  306. \}
  307. .PP
  308. Since matching a